/// @tags: DP
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int constexpr N = 2e3 + 3, P = 1e9 + 7;

int fac[N * N], ifac[N * N], f[N][N];

inline LL qpow(LL base, int exp = P - 2) {
  LL res = 1;
  for (; exp; exp >>= 1, base = base * base % P) {
    if (exp & 1) res = res * base % P;
  }
  return res;
}

inline LL C(int n, int m) {
  return n >= m ? (LL)fac[n] * ifac[m] % P * ifac[n - m] % P : 0;
}

inline int inc(int a, int b) {
  a += b;
  return a >= P ? a - P : a;
}

inline int main() {
  int n, k;
  cin >> n >> k;
  if (k == 1) return cout << '1', 0;
  fac[0] = 1;
  for (int i = 1; i <= n * k; ++i) fac[i] = (LL)fac[i - 1] * i % P;
  ifac[n * k] = qpow(fac[n * k]);
  for (int i = n * k - 1; i >= 0; --i) ifac[i] = (LL)ifac[i + 1] * (i + 1) % P;
  for (int i = 1; i <= n; ++i) f[i][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) {
      f[i][j] = inc(f[i][j], f[i - 1][j]);
      f[i][j] = inc(f[i][j], (LL)f[i][j - 1] * (n - j + 1) % P *
                                 C(n * k - i - (j - 1) * (k - 1) - 1, k - 2) % P);
    }
  }
  cout << f[n][n];
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("AT2000 [AGC002F] Leftmost Ball.in", "r", stdin);
  freopen("AT2000 [AGC002F] Leftmost Ball.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
